// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
// 从node_modules中引入jq
import $ from 'jquery'
// 从node_modules中引入axios
import axios from 'axios'
// 引入store
import store from './store'
// 等价于 import store from './store/index.js'
// 引入element组件
import ElementUI from 'element-ui';
// 引入element样式
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

Vue.config.productionTip = false
// 声明一个空实例,添加到vue原型链上
Vue.prototype.eventbus = new Vue();
// 将jq添加到vue的原型链上，方便全局使用
Vue.prototype.$ = $;
// 讲vue原有的http模块替换为axios
Vue.prototype.$http = axios;
router.beforeEach((to, from, next)=> {
  // if(to.path === 'usercenter') {

  // }
  console.log('我是全局');
  document.title = to.meta.title;
  next()
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
